<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%
	String bathPath = request.getContextPath();
	pageContext.setAttribute("bathPath", bathPath);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>部门</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script type="text/javascript" src="${bathPath}/js/jquery-1.9.1.min.js" ></script>
<link rel="stylesheet" href="${bathPath}/frame/layui/css/layui.css"  media="all">
<script src="${bathPath}/frame/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<link rel="stylesheet" href="${bathPath}/layui_ext/dtree/dtree.css">
<link rel="stylesheet" href="${bathPath}/layui_ext/dtree/font/dtreefont.css">
</head>
<style type="text/css"> 
.layui-table-cell .layui-form-checkbox[lay-skin="primary"]{
     top: 50%;
     transform: translateY(-50%);    
}
</style>
<body>
<div class="layui-tab" lay-filter="demo" lay-allowclose="true" style="height:492px; width:910px;margin-left:20px;">
  <ul class="layui-tab-title">
    <li lay-id="22">门状态查询</li>
  </ul>
  <div class="layui-tab-content" style="height:450px; width:910px">
    <div class="layui-tab-item layui-show" >
  <form id="myform" class="layui-form layui-form-pane">
 <div class="demoTable" style="margin-top: 60px;margin-left:30px;"> 
</div> 
</form>

<!--增加/删除  -->
<div ><%-- <span><button data-url = "${bathPath}/aDKNetGroup/index1.action" style="margin-top: -60px;"  data-id = "1" data-title = "增加组织机构" class="layui-btn site-demo-active" data-type="tabAdd">增加</button></span> --%>
<span><button class="layui-btn site-demo-active layui-btn-sm" dtree-id="demoTree1" dtree-menu="moveDown" style="margin-top: -90px;position:relative;">展开全部节点</button></span>
<span><button class="layui-btn site-demo-active layui-btn-sm" dtree-id="demoTree1" dtree-menu="moveUp" style="margin-top: -90px;position:relative;">收缩全部节点</button></span>
<span><button class="layui-btn site-demo-active layui-btn-sm" dtree-id="demoTree1" dtree-menu="quanxuan" style="margin-top: -90px;position:relative;">全选</button></span> 
<span><button class="layui-btn site-demo-active layui-btn-sm" dtree-id="demoTree1" dtree-menu="unquanxuan" style="margin-top: -90px;position:relative;">全不选</button></span> 
<span><button class="layui-btn site-demo-active layui-btn-sm" style="margin-top: -90px;position:relative;" onclick="" >远程开门</button></span>

</div>
<!--树形  -->
<div style="height:410px;width:200px;overflow:auto; margin-top:-30px; margin-left:-20px;" id="toolbarDiv">
	<ul id="demoTree1" class="dtree" data-id="0" style="width:180px;height:410px;"></ul>
</div>
<!-- 页面 -->
<div>
<%-- <iframe id="myIframe" name="mainIframe" frameborder="0" style="width:700px;min-width:700px;height:410px;margin-left:200px;margin-top:-410px;" src="${bathPath}/aDKAccessLog/toAddAccessLog.action?id=1"> --%>
<iframe id="myIframe" name="mainIframe" frameborder="0" style="width:700px;min-width:700px;height:410px;margin-left:200px;margin-top:-410px;" src="">
</iframe>
</div>
</div>
</div>
<script src="${bathPath}/frame/layui/layui.js" charset="utf-8"></script>
<script>
var jiedian;
var autoId;
$(function(){
	$.ajax({
		type:"POST",
		async:false,  //默认true,异步
		url:"${bathPath}/aDKDoor/selectAll.action",
		success:function(data){
	      jiedian=data.data;
	      layui.config({
			  base: '${bathPath}/layui_ext/dtree/' //配置 layui第三方扩展组件存放的基础目录
			}).extend({
			  dtree: 'dtree' //定义该组件模块名
			}).use(['element','layer', 'dtree'],function(){
				var layer = layui.layer,
				    dtree = layui.dtree,
				    $ = layui.$;
				dtree.render({
				  elem: "#demoTree1", //绑定元素
				  data: data,  //数据
				  spread: false,
				  initLevel: "1",//收缩节点
				  checkbar:true,//开启check
				  menubar:true,//开启菜单栏
				  menubarTips:{
				    freedom:[{menubarId:"quanxuan",handler:function(node){
				    	//layer.msg(JSON.stringify(node.ischecked));
				    	$(".dtree-nav-checkbox-div i").removeClass("dtree-icon-fuxuankuang");
				    	$(".dtree-nav-checkbox-div i").addClass("dtree-icon-fuxuankuangxuanzhong dtree-theme-choose");
				    	}},
				    	{menubarId:"unquanxuan",handler:function(node){
					    	//layer.msg(JSON.stringify(node.ischecked));
					    	$(".dtree-nav-checkbox-div i").removeClass("dtree-icon-fuxuankuangxuanzhong dtree-theme-choose");
					    	$(".dtree-nav-checkbox-div i").addClass("dtree-icon-fuxuankuang");
					    	//$(".dtree-nav-checkbox-div i").removeClass("dtree-icon-fuxuankuang");
					    	//$(".dtree-nav-checkbox-div i").addClass("dtree-icon-fuxuankuangxuanzhong dtree-theme-choose");
					    	}}],
				    group:[] //按钮组制空
				  }
				});
				//单击节点 监听事件
				dtree.on("node('demoTree1')" ,function(param){
					//回填页面
					if(param.param.parentId!=-1){
						$("#myIframe").attr("src","${bathPath}/aDKAccessLog/toAddAccessLog.action?id="+param.param.nodeId);
						autoId=param.param.nodeId;
					}
				});
			});
	    }
	});
}); 
</script>
</div>
</body>
<script>
$("#cAll").click(function(){//全选
	//alert("进入全选");
    $(".dtree-nav-checkbox-div").attr("checked","checked");
  })
</script>
</html>